package com.tledu.springboot02.dao;

import com.tledu.springboot02.model.User;
import com.tledu.springboot02.rowMapper.UserRowMapper;
import lombok.AllArgsConstructor;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Antg
 * @date 2021/8/24  16:08
 */
@Repository
@AllArgsConstructor
public class UserDao implements IUserDao{
    private final JdbcTemplate jdbcTemplate;
    @Override
    public List<User> findAll() {
        List<User> list = jdbcTemplate.query("select * from user", new UserRowMapper());
        return list;
    }
}
